Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make AT128 scans align with scan_phase #84

Merged
merged 16 commits into from
Nov 29, 2023

Conversation

mojomex
Copy link
Collaborator

@mojomex mojomex commented Oct 30, 2023

PR Type

  • Bug Fix

Related Links

TIER IV INTERNAL LINK -- AT128 scan_angle troubleshooting log

Description

Before this PR, AT128's pointcloud timestamps were not aligned to top of second at the set scan_angle.
The refactoring in #42 introduced a wrong calculation for scan cutting in AT128 (subtracted scan_angle in output coordinates from the raw azimuth value).
Further, AT128's 3.50.6 software version set scan_angle as-is, without converting internally to encoder angles first.
This has been fixed in 3.50.8.

This PR fixes this issue via the following code changes:

  • handle scan_angle in the respective angle_corrector_... implementations, not in hesai_decoder
  • set the scan_phase parameter in the AT128 configuration file to 30.0 (the lowest legal value)
  • add AT128 software version requirements to the readme file

Review Procedure

Run Nebula with AT128, set scan_angle to different values 30 <= scan_angle <= 150 and observe the timestamps of the output pointclouds:

ros2 topic echo --field header.stamp.nanosec /pandar_points 

If the second and third digits are always close to 0, the fix is working.

Remarks

Because channel corrections can range from around -3 to +3 deg for the same encoder angle, there is a range of output angles associated with the encoder angle. Currently, the scan cutting/angle conversion code ignores this. It is a design decision whether to align to the earliest channel to hit scan_angle or to align channel-agnostically (without factoring in correction). The latter ends up roughly in the mean of all channels.

Here is an excerpt from the extensive analysis, showing scan_angle = 90 deg. Black is aligned to 0.X000... s, yellow is maximally unaligned (0.Y999... s). Channel 0 is the innermost ring, channel 127 the outermost. One can see that the points at the same output angle are not all aligned to ToS.
image

Pre-Review Checklist for the PR Author

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

@mojomex mojomex requested review from amc-nu and drwnz October 30, 2023 07:13
@mojomex mojomex self-assigned this Oct 30, 2023
Plot angle timings rel to ToS
@mojomex mojomex force-pushed the at128_top_of_second_diag branch from 54cb3b7 to e715687 Compare October 30, 2023 07:18
@mojomex mojomex marked this pull request as ready for review November 1, 2023 10:20
@codecov-commenter
Copy link

codecov-commenter commented Nov 1, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (7e28d15) 8.28% compared to head (c13eaa0) 13.83%.

Files Patch % Lines
...sai/decoders/angle_corrector_calibration_based.hpp 50.00% 2 Missing and 1 partial ⚠️
...esai/decoders/angle_corrector_correction_based.hpp 0.00% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            main      #84      +/-   ##
=========================================
+ Coverage   8.28%   13.83%   +5.54%     
=========================================
  Files         87       45      -42     
  Lines       8456     4526    -3930     
  Branches     852      799      -53     
=========================================
- Hits         701      626      -75     
+ Misses      7180     3346    -3834     
+ Partials     575      554      -21     
Flag Coverage Δ
differential 13.83% <54.54%> (?)
total ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knzo25
Copy link
Collaborator

knzo25 commented Nov 7, 2023

@mojomex
FYI, internal links in public repositories are usually presented as TIER IV INTERNAL LINK
👍

@mojomex mojomex marked this pull request as draft November 13, 2023 06:30
* Scans are always cut at the start of a mirror now
* Scan phase is sent as-is (in output coordinates) to the sensor,
  since it handles the conversion internally now.
@mojomex mojomex marked this pull request as ready for review November 16, 2023 08:10
Copy link
Collaborator

@drwnz drwnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, and ready to merge - but do you mind removing 14b43c0c0e9b69fc941e422a246e1169017fff73 to make merging as simple as possible?

nebula_ros/config/hesai/PandarAT128.yaml Outdated Show resolved Hide resolved
@mojomex mojomex force-pushed the at128_top_of_second_diag branch from 14b43c0 to a0b14d4 Compare November 29, 2023 10:14
@mojomex
Copy link
Collaborator Author

mojomex commented Nov 29, 2023

Done 👍

@mojomex mojomex requested a review from drwnz November 29, 2023 10:49
Copy link
Collaborator

@drwnz drwnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@drwnz drwnz merged commit c71a157 into tier4:main Nov 29, 2023
6 checks passed
@mojomex mojomex deleted the at128_top_of_second_diag branch November 29, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants